var gulp = require('gulp');
var htmlclean = require('gulp-htmlclean');
var cleanCSS = require('gulp-clean-css');

gulp.task('minify-html', function () {
  return gulp.src('./*.html')
    .pipe(htmlclean({
      protect: /<\!--%fooTemplate\b.*?%-->/g,
      edit: function (html) { return html.replace(/\begg(s?)\b/ig, 'omelet$1'); }
    }))
    .pipe(gulp.dest('./dist/'));
})

gulp.task('minify-css', () => {
  return gulp.src('*.css')
    .pipe(cleanCSS({ compatibility: 'ie8' }))
    .pipe(gulp.dest('dist'));
});

gulp.task('default', ['minify-html', 'minify-css'])
